package com.example.brvah_test;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.util.List;

/**
 * @Description
 * @Author xudan
 * @CreateTime 2024/4/24
 */
public class MyMultiAdapter extends BaseMultiItemQuickAdapter<Bean, BaseViewHolder> {

    public MyMultiAdapter(List<Bean> data) {
        super(data);
        addItemType(1, R.layout.multi_layout1);
        addItemType(2, R.layout.multi_layout2);
        addItemType(3, R.layout.multi_layout3);
    }

    @Override
    protected void convert(BaseViewHolder helper, Bean item) {
        switch (item.getItemType()) {
            case 1:
                helper.setText(R.id.mName1, item.getName());
                helper.setText(R.id.mTitle1, item.getTitle());
                break;
            case 2:
                helper.setText(R.id.mName2, item.getName());
                helper.setText(R.id.mTitle2, item.getTitle());
                break;
            case 3:
                helper.setText(R.id.mName3, item.getName());
                helper.setText(R.id.mTitle3, item.getTitle());
                break;
        }
    }
}
